home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / PowerPlant / LDelayedTask / LDelayedTask.h < prev    next >
Encoding:
Text File  |  1995-08-28  |  1.8 KB  |  65 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //        • LDelayedTask.h            © 1995, Éric Forget. All rights reserved.
  3. // ===========================================================================
  4. //
  5. //    ************************************************************************
  6. //    *                                                                      *
  7. //    *    Before using this code you should read the "License Agreement"     *
  8. //    *    document and agree with it.                                        *
  9. //    *                                                                      *
  10. //    ************************************************************************
  11. //
  12. //    Instruction and usage notes are in the LDelayedTask.cp file.
  13. //
  14. // ---------------------------------------------------------------------------
  15.  
  16.  
  17. #pragma once
  18.  
  19. #include    "LTask.h"
  20.  
  21.  
  22. // ---------------------------------------------------------------------------
  23. //        • Class LDelayedTask
  24. // ---------------------------------------------------------------------------
  25.  
  26. class LDelayedTask :    public LTask {
  27.  
  28. private:
  29.                                 LDelayedTask() {}    // Impossible constructor!
  30. public:
  31.                                 LDelayedTask(Int32    inFirstDelay,
  32.                                         Int32    inNextDelay,
  33.                                         Boolean inDeleteOnCompletion = false);
  34.     virtual                        ~LDelayedTask();
  35.     
  36.     virtual void                StartTask();
  37.     virtual void                StopTask();
  38.     void                        RestartTask()
  39.                                 {
  40.                                     if(!IsExecuting()) {
  41.                                         
  42.                                         StartTask();
  43.                                     }
  44.                                     mIsFirstTask = true;
  45.                                     mStartTime = ::TickCount();
  46.                                 }
  47.     
  48.     virtual Boolean                IsItTimeToExecute();
  49.     
  50.     Boolean                        IsFirstTask()
  51.                                 {
  52.                                     return mIsFirstTask;
  53.                                 }
  54.     
  55. protected:
  56.     Int32                        mStartTime;
  57.     Boolean                        mIsFirstTask;
  58.     
  59.     virtual void                ContinueTask();
  60.     
  61.     virtual void                StartTaskSelf();
  62.     virtual void                StopTaskSelf();
  63. };
  64.  
  65.